<?php
	include ('../inc/config.php');
	header('Content-Type: application/json');
    $plan_id     = request('plan_id',0);
    $producto_id = request('producto_id',0);

	
	//----------------------------------------------------------------
	//                                              Obtiene los planes
	//----------------------------------------------------------------
	$sql  = "select * from planes_alojamientos where activo='1' and plan='$plan_id'";
	$rs   = $db->CacheExecute($sql);
	$Plan = $rs->FetchRow();	

	if(isset($Plan['id']) and $Plan['id']>0){
	
		$sql  = "select id, plan, reserva_online, ficha_interna, top_10_categoria from productos where id='$producto_id'";
		$rs   = $db->SelectLimit($sql,1);
		$data = $rs->FetchRow();
		
		$data['plan']           = $Plan['plan'];
		$data['reserva_online'] = $Plan['reserva_online'];
		$data['ficha_interna']  = $Plan['ficha_interna'];
		$data['top_10_categoria']  = $Plan['top_10_categoria'];
	    $ok = $db->Replace('productos', $data,'id', $autoquote = true); 	

		$result = array("id"=>$data['id'], "plan"=>$data['plan'], "reserva_online" => $data['reserva_online'], "ficha_interna" => $data['ficha_interna']);
		
		echo array_to_json($result);
		
	
	} else {
		echo "";
	}
?>